package per.kongtouxu.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import per.kongtouxu.domain.pojo.PageBean;
import per.kongtouxu.domain.vo.V_FileInfo;
import per.kongtouxu.domain.vo.V_UserScoreIo;
import per.kongtouxu.service.UserScoreIoService;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@RestController
@RequestMapping("/scoreIo")
public class ScoreIoController {
    @Autowired
    private UserScoreIoService userScoreIoService;
    //分页查询
    @RequestMapping("/pageFind")
    public PageBean<V_UserScoreIo> pageFind(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //1.获取参数
        String startTime = req.getParameter("startTime");
        String endTime = req.getParameter("endTime");
        String currentPage = req.getParameter("currentPage");
        String pageSize = req.getParameter("pageSize");
        String userId = req.getParameter("userId");

        PageBean<V_UserScoreIo> pageBean =null;
        //2.查询service
        pageBean = userScoreIoService.pageFind(startTime, endTime, Integer.parseInt(userId),Integer.parseInt(currentPage), Integer.parseInt(pageSize));
        System.out.println(pageBean);
        //3.返回JSON
        return pageBean;
    }
}
